{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": 3
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python_defaultSpec_1597155904435",
   "display_name": "Python 3.7.1 64-bit ('base': conda)"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys; sys.path.append(\"C:/GitWorks/pdb-profiling\")\n",
    "from pdb_profiling.fetcher.webfetch import UnsyncFetch\n",
    "from pdb_profiling.processers.pdbe.api import ProcessPDBe, PDBeDecoder, FUNCS\n",
    "from pdb_profiling.utils import init_semaphore, split_df_by_chain, slice_series, to_interval, a_read_csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from collections import Counter\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import orjson as json\n",
    "from pathlib import Path\n",
    "from unsync import unsync\n",
    "from collections import defaultdict\n",
    "from time import perf_counter\n",
    "from typing import Iterable, Union"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "UnsyncFetch.use_existing = True\n",
    "ProcessPDBe.use_existing = True\n",
    "ProcessPDBe.init_logger()\n",
    "semaphore = init_semaphore(30).result()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "['api/pdb/entry/cofactor/',\n 'api/pdb/entry/ligand_monomers/',\n 'api/pdb/entry/experiment/',\n 'api/pdb/entry/mutated_AA_or_NA/',\n 'api/pdb/entry/status/',\n 'api/pdb/entry/summary/',\n 'api/pdb/entry/drugbank/',\n 'api/pdb/entry/electron_density_statistics/',\n 'api/pdb/entry/related_experiment_data/',\n 'api/pdb/entry/modified_AA_or_NA/',\n 'api/pdb/entry/molecules/',\n 'api/pdb/entry/polymer_coverage/',\n 'api/pdb/entry/observed_residues_ratio/',\n 'api/pdb/entry/residue_listing/',\n 'api/pdb/entry/secondary_structure/',\n 'api/pdb/entry/binding_sites/',\n 'api/pdb/entry/assembly/',\n 'api/pdb/entry/files/',\n 'api/mappings/all_isoforms/',\n 'api/pisa/interfacelist/',\n 'api/pisa/interfacedetail/']"
     },
     "metadata": {},
     "execution_count": 4
    }
   ],
   "source": [
    "[j for i in FUNCS for j in i[1]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "reslist_suffix = 'api/pdb/entry/residue_listing/'\n",
    "eec_suffix = 'api/pdb/entry/molecules/'\n",
    "obseec_suffix = 'api/pdb/entry/observed_residues_ratio/'\n",
    "assembly_suffix = 'api/pdb/entry/assembly/'\n",
    "interfacelist_suffix = 'api/pisa/interfacelist/'\n",
    "interfacedetail_suffix = 'api/pisa/interfacedetail/'\n",
    "\n",
    "reslist_path, eec_path, obseec_path, assembly_path, interfacelist_path, interfacedetail_path = \\\n",
    "    tuple(PDBeDecoder.init_folder('./demo/', (reslist_suffix, eec_suffix, obseec_suffix, assembly_suffix, interfacelist_suffix, interfacedetail_suffix)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}